//
//  KLHotaldetailTableViewCell.m
//  KunLun
//
//  Created by Mac on 2017/11/28.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLMyuploadTableViewCell.h"

@interface KLMyuploadTableViewCell()
@property(nonatomic, strong) UIImageView                     *iconImageView;
@property(nonatomic, strong) STLabel                            *titleLable;
@property(nonatomic, strong) STLabel                            *orderLable;//订单号
@property(nonatomic, strong) STLabel                            *timeLbale;//id

@end
@implementation KLMyuploadTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self ==[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self configSubView];
    }
    return self;
}
+ (CGFloat)cellHeight{
    return 120;
}
#pragma mark --subView
- (void)configSubView{
    
    self.backgroundColor = [UIColor whiteColor];
    
    self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(15, 10, 90, 90)];
    self.iconImageView.image = [UIImage imageNamed:@"12"];
    [self addSubview:self.iconImageView];
    
    self.titleLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.iconImageView.top , UIScreenWidth - self.iconImageView.right - 20, 50)
                                                text:@"特惠吴川过大船方fds斯蒂芬斯蒂芬蒂芬商店胜多负少"
                                           textColor:KL_firstTextColor
                                                font:15
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.titleLable];
    
    self.orderLable = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.titleLable.bottom +3, UIScreenWidth - self.iconImageView.right - 20, 20)
                                              text:@"订单号：dsadad1313456"
                                         textColor:KL_secendTextColor
                                              font:14
                                       isSizetoFit:NO
                                     textAlignment:NSTextAlignmentLeft];
    [self addSubview:self.orderLable];
    
    self.timeLbale = [[STLabel alloc] initWithFrame:CGRectMake(self.iconImageView.right + 10, self.orderLable.bottom + 5, UIScreenWidth - 20 -self.iconImageView.right , 20)
                                                text:@"2017年11月29日15:11:09"
                                           textColor:KL_secendTextColor
                                                font:14
                                         isSizetoFit:NO
                                       textAlignment:NSTextAlignmentLeft];

    [self addSubview:self.timeLbale];
    
    
    self.contractButton = [[STButton alloc] initWithFrame:CGRectMake(0, 0, 70, 25)
                                                   title:@"联系卖家"
                                              titleColor:[UIColor whiteColor]
                                               titleFont:14
                                            cornerRadius:5
                                         backgroundColor:KL_BlueBackGroundColor
                                         backgroundImage:nil
                                                   image:nil];
    self.contractButton.right = UIScreenWidth - 10;
    self.contractButton.top = self.titleLable.bottom;
    self.contractButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentCenter;
    [self addSubview:self.contractButton];
}
- (void)setModel:(KLUploadModel *)model{
    _model = model;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.screenshot] placeholderImage:nil];
    
    self.titleLable.text = model.goods.goods_name;
    
    self.timeLbale.text = [NSString stringWithFormat:@"订单号:%@",model.order_sn];
    
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:model.created_at.intValue].st_localDate;
    
    self.orderLable.text = date.st_yyyyMMddhhmmssWithDate;
}
@end
